android-pendingintent

sendMultipartTextMessage ISms$Stub$Proxy.sendMultipartTextOnSubscription NullPointerException

可紊 提交于 2019-12-12 09:17:30
问题 Im getting nullpointerexception for the following code: I have SMS of more than 160 characters length, so im dividing them using divide() and then adding one sent PendingIntent. Sometimes this exception comes up. My mobile number and sms data are not null; String SENT = "SMS_SENT"; PendingIntent sentPI = PendingIntent.getBroadcast(this, 0, new Intent( SENT), 0); // ---when the SMS has been sent--- BroadcastReceiver sentSMSStatusReciever = new BroadcastReceiver() { @Override public void

Android notification callback

扶醉桌前 提交于 2019-12-12 09:14:02
问题 I'm using this tutorial on AsyncTask with a task and a notification: https://eliasbland.wordpress.com/2011/03/11/an-example-of-how-to-run-a-background-task-and-report-progress-in-the-status-bar-using-asynctask-on-android/ What I'm confused about is how to make a callback do something in the original class it was called from. Optimally, it would be great to have something like: private class DownloaderTask extends AsyncTask { doInBackground() { ... download the file ... } onProgressUpdate,

Cannot send pending intent from widget, SendIntentException

你说的曾经没有我的故事 提交于 2019-12-12 08:07:17
问题 I want to send a broadcast from my widget with this code: for (int i = 0; i < N; i++) { int appWidgetId = appWidgetIds[i]; RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.widget); Intent x = new Intent(); if (isActive == true) { views.setImageViewResource(R.id.w_image, R.drawable.w_bild); x.setAction("de.bulling.smstalk.DISABLE"); } else { views.setImageViewResource(R.id.w_image, R.drawable.w_bild_off); x.setAction("de.bulling.smstalk.ENABLE"); } PendingIntent z =

Android Set multiple repeat alarms

跟風遠走 提交于 2019-12-12 04:51:12
问题 I want to set 3 different alarms repeat everyday.(like 9:00am,1:00pm,6:00pm) And I have created buttons for them. I can set the alarm's time when I click the button. The problem is how can I change my code to achieve above mentioned. private void setNotification() { Intent myIntent = new Intent(getActivity(), MyReceiver.class); PendingIntent pendingIntent = PendingIntent.getBroadcast(getActivity(), 0, myIntent, 0); AlarmManager alarmManager = (AlarmManager)getActivity().getSystemService

Getting Multiple Notification instead of one in Android

巧了我就是萌 提交于 2019-12-12 04:03:30
问题 I am using Firebase notification in my android app. Generating notification using below code : public class FirebaseNotificationService extends FirebaseMessagingService { private static final String TAG = FirebaseNotificationService.class.getSimpleName(); private String strTitle = "My Notification"; private String strMessage = "No Description"; @Override public void onMessageReceived(RemoteMessage remoteMessage) { if (Prefrences.getBooleanValue(getApplicationContext(), IS_LOGIN) && Prefrences

How to open a specific activity based on Notification

痴心易碎 提交于 2019-12-12 01:52:24
问题 I am currently working on a reminders app in which the user gets a notification with the name of the reminder and is then redirected to an activity which contains the text of the reminder in detail. I am however, only able to redirect to the same activity each time. I am using this code : PendingIntent contentIntent = PendingIntent.getActivity(this, 0, new Intent(this, MainActivity.class), 0); notification.setLatestEventInfo(this, title, text, contentIntent); So this redirects to the

Pending Intent Causing mainactivity to reload, why is that?

末鹿安然 提交于 2019-12-12 00:46:03
问题 I'm trying to write a service that will check every midnight for new data from the server and will download it. But when i start the app the mainActivity screen reloads after few seconds. I'v checed it and it happens because of this service, Why is this happening? Her are the files: MainActivity: i'v created an AlarmManager object to set pendingIntent: //Set alarm /* Retrieve a PendingIntent that will perform a broadcast */ Intent alarmIntent = new Intent(getApplicationContext(),

How to cancel PendingIntent at specific time?

十年热恋 提交于 2019-12-12 00:12:30
问题 AlarmManager works perfectly when I have not declared cancel but do not fire when I declare the cancel .. Here is the code: Calendar c= Calendar.getInstance(); c.set(Calendar.HOUR_OF_DAY, 0); c.set(Calendar.MINUTE, 37); c.set(Calendar.SECOND, 0); Toast.makeText(this, c.getTime().toString(), Toast.LENGTH_LONG).show(); intent = new Intent(TestAlarm.this, TestAlarmService.class); pi = PendingIntent.getService(TestAlarm.this, 1, intent, 0); AlarmManager am = (AlarmManager) getSystemService(ALARM

Pending Intent opens wrong activity

北城以北 提交于 2019-12-11 23:24:08
问题 I am using the FirebaseMessagingService for getting notifications and opening the app upon clickng the notification. But everytime i click the notification the app opens the MainActivity instead of the intended ResultActivity. I also followed docs from the PendingIntent docs and still does the same. private void createNotification( String messageBody) { Intent intent = new Intent( this , ResultActivity.class ); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK|Intent.FLAG_ACTIVITY_CLEAR_TASK);

Android alarm not cancelling

笑着哭i 提交于 2019-12-11 19:33:39
问题 I am in the main activity. There is a Login button bLogin . When it is pressed, a Logout button is displayed bLogout . The onClick methods for the two buttons are as follows: bLogin.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { llLogin.setVisibility(View.GONE); llLogout.setVisibility(View.VISIBLE); PendingIntent pendingIntent = PendingIntent.getBroadcast(getApplicationContext(), 327, new Intent(getApplicationContext(), AlarmReceiver.class),