Reputation: 39
I have created two application 1. HostApp 2. MainApp
HostApp create a remoteview and share it with MainApp over IPC. The Layout inflated on RemoteView contains a button which click event is register using following code
Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.google.com")) ;
PendingIntent pi = PendingIntent.getBroadcast(getBaseContext(), 0 , i, PendingIntent.FLAG_UPDATE_CURRENT);
timeView.setOnClickPendingIntent(R.id.test_button, pi);
Still when the Main App is launched it shown the button but it click event doesn't work.
Upvotes: 1
Views: 599
Reputation: 39
The issue is resolved now, the only challenge is with the line
PendingIntent pi = PendingIntent.getBroadcast(getBaseContext(), 0 , i, PendingIntent.FLAG_UPDATE_CURRENT);
changed it to
PendingIntent pi = PendingIntent.getActivity(getBaseContext(), 0 , i, PendingIntent.FLAG_UPDATE_CURRENT); and it worked.
Upvotes: 1