|
|
Hi Richard,
I had read this guide, but as you can see there is no indication of how to read the notification of a third-party app, there are only instructions on how to create notifications and how the notification is structured in your phone.
Do you know any example applications even if only to read notifications as objects?
Thanks
|
|
|
|
|
Sorry, no. This is a question for Google I am afraid.
|
|
|
|
|
I thought so, but I have been searching for a week with different keywords without success.
Surely there is a way, I just need to find someone who has used it for some project.
|
|
|
|
|
|
That would have been handy, unfortunately 'Notification listeners cannot get notification access'.
Edit: But by searching for that library I found this link which fulfils at least half of my request, so thank you.
https://www.learn2crack.com/2014/11/reading-notification-using-notificationlistenerservice.html
Thanks anyway for your availability
modified 2-Aug-21 5:13am.
|
|
|
|
|
I would think if you could access the notifications of other apps, that would be a sizeable security issue. Imagine being able to "answer" another app's notifications without user intervention!
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
modified 2-Aug-21 11:33am.
|
|
|
|
|
Notifications are handled by the device, no information is sent that could affect security, the user can only interact with what the apps provide.
For this there are public APIs and deep links, it is no problem to use them, you just need to know how.
What I want to do is to simulate user interaction programmatically, so without using inaccessible private app methods, but with native device functions.
|
|
|
|
|
HI, i have created a time lapse camera app that collects images during daylight hours and uploads those images to an FTP server. I now need to add a method to prolong battery life by waking up the cpu at a specific time, collect an image, then go back to sleep between image collections (15 - 20 mins) then stay asleep at night, this is repeated on a daily basis.
The AlarmManager class might be the way to go but my programming skills aren't great. This class has an example that (i think) could wake the cpu at a given time then use the setRepeating method to wake up the device every x minutes after that. Is this correct? However i need it to stop doing that at night and repeat each day, is this possible?
Any advice on this and/or example code to get me started would be much appreciated.
Cheers.
|
|
|
|
|
Caveat - I know nothing about mobile development but it seems to me that putting the cpu to sleep and then asking it to run the alarm manager (while asleep) seems to be a disconnect somewhere!
Never underestimate the power of human stupidity -
RAH
I'm old. I know stuff - JSOP
|
|
|
|
|
Not necessarily. Many (probably almost all) devices have low power sleep modes that can be woken from by real time clock interrupts (and other interrupts, like a pushbutton). So setting a time-of-day alarm and going to sleep is a very effective strategy for minimising power consumption.
Software rusts. Simon Stephenson, ca 1994. So does this signature. me, 2012
|
|
|
|
|
Hence the caveat - ty
Never underestimate the power of human stupidity -
RAH
I'm old. I know stuff - JSOP
|
|
|
|
|
I have an Amazon affiliate site & I want to make an app for this where users can easily find Amazon Coupons in India & get notification as soon as the new coupon deal or promo code arrives in our database.
Please help me understand the technology I should use in my programming & UX.I want to build a fast, efficient and user friendly application for my users.
|
|
|
|
|
You need to hire a guy who will code this app for you.
|
|
|
|
|
Hi
For example, deem I have a rectangle and a button. I want to place the button inside the rectangle with a relative distance from all four sides of the rectangle so that in any screen size, these relations are kept. Please write me a sample XAML code to study.
Thanks.
|
|
|
|
|
<pre lang="Kotlin"><pre>package com.example.cryptotracker
import android.os.Bundle
import android.util.Log
import androidx.appcompat.app.AppCompatActivity
import androidx.recyclerview.widget.LinearLayoutManager
import kotlinx.android.synthetic.main.activity_main.*
import retrofit2.Call
import retrofit2.Callback
import retrofit2.Response
class MainActivity : AppCompatActivity() {
private lateinit var mAdapter :CryptoAdapter
private var crypto1 = mutableListOf<Crypto>()
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
mAdapter = CryptoAdapter(this,crypto1)
recyclerView.adapter = mAdapter
recyclerView.layoutManager = LinearLayoutManager(this)
getCrypto()
}
private fun getCrypto() {
val crypto:Call<CryptoList> = CryptoService.cryptoInstance.getExchanges()
crypto.enqueue(object : Callback<CryptoList> {
override fun onResponse(call: Call<CryptoList>, response: Response<CryptoList>) {
val crypto:CryptoList? = response.body()
if(crypto!=null)
{
Log.d("THISSSSS",crypto.toString())
crypto1.addAll(crypto.crypto1)
mAdapter.notifyDataSetChanged()
}
}
override fun onFailure(call: Call<CryptoList>, t: Throwable) {
Log.d("ERRRRRROR","ERROR IN FETCHING",t)
}
} )
}
}</pre></pre>
<pre lang="Kotlin"><pre>package com.example.cryptotracker
import android.content.Context
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.ImageView
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import com.bumptech.glide.Glide
class CryptoAdapter(val context:Context, val crypto1:List<Crypto> ):RecyclerView.Adapter<CryptoViewHolder>() {
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): CryptoViewHolder {
val view:View = LayoutInflater.from(context).inflate(R.layout.item_crypto,parent,false)
return CryptoViewHolder(view)
}
override fun onBindViewHolder(holder: CryptoViewHolder, position: Int) {
val current_item:Crypto = crypto1[position]
holder.cryptoName.text = current_item.name
holder.cryptoCountry.text = current_item.country
holder.cryptoUrl.text = current_item.url
holder.cryptoVolume.text = current_item.trade_volume_24h_btc
Glide.with(context).load(current_item.image).into(holder.cryptoImage)
}
override fun getItemCount(): Int {
return crypto1.size
}
}
class CryptoViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
var cryptoName = itemView.findViewById<TextView>(R.id.cryptoName)
var cryptoImage = itemView.findViewById<ImageView>(R.id.cryptoImage)
var cryptoCountry = itemView.findViewById<TextView>(R.id.cryptoCountry)
var cryptoUrl = itemView.findViewById<TextView>(R.id.cryptoUrl)
var cryptoVolume = itemView.findViewById<TextView>(R.id.cryptoVolume)
}</pre></pre>
<pre lang="Kotlin"><pre>package com.example.cryptotracker
import retrofit2.Call
import retrofit2.Retrofit
import retrofit2.http.GET
import retrofit2.create
import retrofit2.converter.gson.GsonConverterFactory
import retrofit2.http.Query
const val BASE_URL = "https://api.coingecko.com/"
interface CryptoInteface {
@GET("api/v3/exchanges")
fun getExchanges(): Call<CryptoList>
}
object CryptoService {
val cryptoInstance: CryptoInteface
init {
val retrofit: Retrofit = Retrofit.Builder()
.baseUrl(BASE_URL).addConverterFactory(GsonConverterFactory.create())
.build()
cryptoInstance = retrofit.create(CryptoInteface::class.java)
}
}</pre></pre>
<pre lang="Kotlin"><pre>package com.example.cryptotracker
data class CryptoList (
val crypto1:List<Crypto>
)</pre></pre>
<pre lang="Kotlin">package com.example.cryptotracker
data class Crypto (
val name:String,
val country:String,
val url:String,
val image:String,
val trade_volume_24h_btc:String,
val trade_volume_24h_btc_normalized:String
)</pre>
<pre lang="text">com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was BEGIN_ARRAY at line 1 column 2 path $
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:226)
at retrofit2.converter.gson.GsonResponseBodyConverter.convert(GsonResponseBodyConverter.java:40)
at retrofit2.converter.gson.GsonResponseBodyConverter.convert(GsonResponseBodyConverter.java:27)
at retrofit2.OkHttpCall.parseResponse(OkHttpCall.java:243)
at retrofit2.OkHttpCall$1.onResponse(OkHttpCall.java:153)
at okhttp3.RealCall$AsyncCall.execute(RealCall.java:174)
at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:764)
Caused by: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was BEGIN_ARRAY at line 1 column 2 path $
at com.google.gson.stream.JsonReader.beginObject(JsonReader.java:386)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:215)
at retrofit2.converter.gson.GsonResponseBodyConverter.convert(GsonResponseBodyConverter.java:40)
at retrofit2.converter.gson.GsonResponseBodyConverter.convert(GsonResponseBodyConverter.java:27)
at retrofit2.OkHttpCall.parseResponse(OkHttpCall.java:243)
at retrofit2.OkHttpCall$1.onResponse(OkHttpCall.java:153)
at okhttp3.RealCall$AsyncCall.execute(RealCall.java:174)
at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:764) </pre>
|
|
|
|
|
jerry pugu wrote: Expected BEGIN_OBJECT but was BEGIN_ARRAY at line 1 column 2 path $
The JSON you are trying to deserialize doesn't match the object graph you are trying to deserialize it to.
Specifically, you are expecting JSON that represents a single object, but the JSON you are trying to deserialize represents an array of objects.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
thank you i also ahd the same problem i think these code lines would solve that
|
|
|
|
|
What are the basic topics needed for app development .I had learned the concepts of inheritence , virtual functions and polymorphism. Is template concept is needed ? Please give the list of all topics needed or oops concepts .
|
|
|
|
|
I have made a BMI calculator based on a tutorial from Youtube. I added a wallpaper to my app. I want to add a transparent frame to my background and all the controls would be put on that frame.
I tried this code:
<Frame BackgroundColor="Black"
CornerRadius="10"
HasShadow="False"
Opacity="0.5"
Margin="30">
<FlexLayout Direction="Column"
JustifyContent="SpaceEvenly"
Padding="5">
<StackLayout>
<Label Text="قد شما چند سانتیمتر است؟"
Style="{StaticResource TitleStyle}"/>
<Label Text="{Binding Source={x:Reference HeightSlider},
Path=Value,
StringFormat='{0:F0} cm'}"
Style="{StaticResource ValueStyle}"/>
<Slider x:Name="HeightSlider"
Maximum="220"
Minimum="40"
Value="{Binding Height}"/>
</StackLayout>
<StackLayout>
<Label Text="وزن شما چند کیلوگرم است؟"
Style="{StaticResource TitleStyle}"/>
<Label Text="{Binding Source={x:Reference WeightSlider},
Path=Value,
StringFormat='{0:F0} kg'}"
Style="{StaticResource ValueStyle}"/>
<Slider x:Name="WeightSlider"
Maximum="150"
Minimum="5"
Value="{Binding Weight}"/>
</StackLayout>
<StackLayout>
<Label Text="شاخص توده بدنی شما:"
Style="{StaticResource LabelStyle}"/>
<Label Text="{Binding BMI}"
Style="{StaticResource LabelStyle}"
FontSize="48"/>
<Label Text="{Binding Classification}"
Style="{StaticResource LabelStyle}"
FontSize="20"/>
</StackLayout>
</FlexLayout>
</Frame>
The problem is that all the child nodes get affected by opacity and marigin settings.
I want to have opacity just in fram, not child nodes. Also, Child nodes must have their own padding.
How to fix this problem?
|
|
|
|
|
You need to specify the values for child controls, otherwise they inherit from the parent.
|
|
|
|
|
I added
Opacity ="1" to each child control, but it doesn't take any effect and all the child controls are still semi-transparent.
<Frame BackgroundColor="Black"
CornerRadius="10"
HasShadow="False"
Opacity="0.5"
Margin="30">
<FlexLayout Direction="Column"
JustifyContent="SpaceEvenly"
Padding="5">
<StackLayout Opacity="1">
<Label Text="قد شما چند سانتیمتر است؟"
Style="{StaticResource TitleStyle}"/>
<Label Text="{Binding Source={x:Reference HeightSlider},
Path=Value,
StringFormat='{0:F0} cm'}"
Style="{StaticResource ValueStyle}"/>
<Slider x:Name="HeightSlider"
Maximum="220"
Minimum="40"
Value="{Binding Height}"/>
</StackLayout>
<StackLayout Opacity="1">
<Label Text="وزن شما چند کیلوگرم است؟"
Style="{StaticResource TitleStyle}"/>
<Label Text="{Binding Source={x:Reference WeightSlider},
Path=Value,
StringFormat='{0:F0} kg'}"
Style="{StaticResource ValueStyle}"/>
<Slider x:Name="WeightSlider"
Maximum="150"
Minimum="5"
Value="{Binding Weight}"/>
</StackLayout>
<StackLayout Opacity="1">
<Label Text="شاخص توده بدنی شما:"
Style="{StaticResource LabelStyle}"/>
<Label Text="{Binding BMI}"
Style="{StaticResource LabelStyle}"
FontSize="48"/>
<Label Text="{Binding Classification}"
Style="{StaticResource LabelStyle}"
FontSize="20"/>
</StackLayout>
</FlexLayout>
</Frame>
|
|
|
|
|
|
I read it. But I couldn't find any way to separate chide control opacity from its parent.
Can you help me?
|
|
|
|
|
Sorry, I have never used it. But the remarks suggest you need a higher value for the child. Try some different numbers to see which one works.
|
|
|
|