top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Android: Manage variable value with alarm manager event?

+2 votes
193 views

In my code, I have an AlarmManager and it triggers a notification when the time elapses, which works fine. When setting the alarm, the alarm details are saved into DB, when the alarm is set off, I need to recall the alarm information, is there some form of variable I can save into the DB.

posted Jul 5, 2016 by Akshay

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+1 vote
 
Best answer

The key you were looking for is PendingIntent.

long dbid = db.insert("<query>"); // or any other db transaction

Now create normal intent for AlarmManager.

Intent intent = new Intent(this, AlarmEventReceiver.class);
alarmIntent.putExtra("dbId", dbid); 

Then add to Pending Intent.

PendingIntent pendingIntent = PendingIntent.getBroadcast(this, 0,  intent, 0);

In onReceive method on AlarmEventReceiver

long dbid = intent.getLongExtra("dbId", 0);

Note: AlarmEventReceiver is subclass of BroadcastReceiver

answer Jul 6, 2016 by Vinod Kumar K V
Similar Questions
+3 votes

I've been trying to figure out how an android app is installed by browsing AOSP.

The PackageManagerService.java has the gids for the corresponding permissions by parsing the platform.xml file.

PackageInstallerActivity parses and checks for any existing packages and then invokes the InstallAppProgress

I was able to follow the paths where the package is parsed and validated and PackagerManager.installPackage() method is invoked to install the package. I know this makes a native call to the JNI library. The corresponding aidl file is IPackageManager.aidl.

What I want to know is where can I find the Native cpp code related to this aidl mentioned above?

+1 vote

Suppose I have two apps which are using location service.

Inside the service manager I want to identify these calls separately for these apps, such as I can say that this call is for ProcessX and that call is for ProcessY. How would I do it?

+1 vote

Where can I find the code that takes care of the "notification panel revealed" (notification curtain down) event?
Id like to understand the logic that control the order of appearance of the notifications once you swipe down the curtain...

...