Click here to Skip to main content
14,837,944 members
Home / Discussions / Android
   

Android

 
Questionscreen record Pin
mahmoodebi28-Oct-14 21:29
Membermahmoodebi28-Oct-14 21:29 
AnswerRe: screen record Pin
Richard MacCutchan28-Oct-14 22:53
mveRichard MacCutchan28-Oct-14 22:53 
QuestionApplication Architecture Pin
ericgahn25-Oct-14 0:09
Memberericgahn25-Oct-14 0:09 
AnswerRe: Application Architecture Pin
Richard MacCutchan25-Oct-14 0:17
mveRichard MacCutchan25-Oct-14 0:17 
GeneralRe: Application Architecture Pin
ericgahn27-Oct-14 2:27
Memberericgahn27-Oct-14 2:27 
AnswerRe: Application Architecture Pin
Dominic Burford27-Oct-14 1:16
professionalDominic Burford27-Oct-14 1:16 
GeneralRe: Application Architecture Pin
ericgahn27-Oct-14 2:30
Memberericgahn27-Oct-14 2:30 
AnswerRe: Application Architecture Pin
gupta.avinash27-Oct-14 3:33
professionalgupta.avinash27-Oct-14 3:33 
Create an Android Application project, register a Broadcast Receiver with action android.intent.action.BOOT_COMPLETED in the Manifest file.
<receiver android:name=".MyReceiver" >
            <intent-filter>
                <action android:name="android.intent.action.BOOT_COMPLETED" />
            </intent-filter>
</receiver>

Then start the Service from the onReceive() method of the Broadcast Receiver.
public class MyReceiver extends BroadcastReceiver {
			
	@Override
	public void onReceive(Context context, Intent intent) {		
        	Intent i = new Intent(context, MyService.class); 
        	context.startService(i);         
	}
}


Create an Activity with the desired UI and pass that Activity as Pending Intent to the notification.
Intent intent = new Intent(this, MyActivity.class);
PendingIntent launchIntent = PendingIntent.getActivity(context, 0, intent, 0);

When the user taps on the Notification, the Activity used to create the PendingIntent is started.

P.S. - You can have Service, BroadcastReceiver and Activities all in one project.

modified 27-Oct-14 14:11pm.

GeneralRe: Application Architecture Pin
Dominic Burford27-Oct-14 4:24
professionalDominic Burford27-Oct-14 4:24 
GeneralRe: Application Architecture Pin
ericgahn27-Oct-14 4:51
Memberericgahn27-Oct-14 4:51 
GeneralRe: Application Architecture Pin
Dominic Burford27-Oct-14 6:50
professionalDominic Burford27-Oct-14 6:50 
GeneralRe: Application Architecture Pin
ericgahn27-Oct-14 7:16
Memberericgahn27-Oct-14 7:16 
GeneralRe: Application Architecture Pin
Dominic Burford27-Oct-14 7:20
professionalDominic Burford27-Oct-14 7:20 
GeneralRe: Application Architecture Pin
ericgahn27-Oct-14 8:15
Memberericgahn27-Oct-14 8:15 
GeneralRe: Application Architecture Pin
dr.samuel.john27-Oct-14 8:04
Memberdr.samuel.john27-Oct-14 8:04 
QuestionSetBackroundDrawable? Pin
András Ferencz18-Oct-14 10:02
MemberAndrás Ferencz18-Oct-14 10:02 
Questionremote desktop sharing Pin
Member 1101928217-Oct-14 20:35
MemberMember 1101928217-Oct-14 20:35 
QuestionService not always being restarted after being stopped Pin
NormR112-Oct-14 5:18
MemberNormR112-Oct-14 5:18 
AnswerRe: Service not always being restarted after being stopped Pin
gupta.avinash16-Oct-14 7:09
professionalgupta.avinash16-Oct-14 7:09 
GeneralRe: Service not always being restarted after being stopped Pin
NormR116-Oct-14 7:17
MemberNormR116-Oct-14 7:17 
AnswerRe: Service not always being restarted after being stopped Pin
gupta.avinash16-Oct-14 8:25
professionalgupta.avinash16-Oct-14 8:25 
GeneralRe: Service not always being restarted after being stopped Pin
NormR116-Oct-14 8:35
MemberNormR116-Oct-14 8:35 
Questionweb developer Pin
Member 111167273-Oct-14 0:21
MemberMember 111167273-Oct-14 0:21 
AnswerRe: web developer Pin
Richard MacCutchan3-Oct-14 2:53
mveRichard MacCutchan3-Oct-14 2:53 
AnswerRe: web developer Pin
David Crow7-Oct-14 3:33
MemberDavid Crow7-Oct-14 3:33 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.