Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7091823
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T08:14:09+00:00 2026-05-28T08:14:09+00:00

Hai tried to get the latitude and longtitude value using service class.my service function

  • 0

Hai tried to get the latitude and longtitude value using service class.my service function is working very fine.but i canot start the activity for gpsclass.am getting force close.i added the class in manifest file also

manifest file

<?xml version="1.0" encoding="utf-8"?>
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
  package="com.javaorigin.android.sample.service"
  android:versionCode="1"
  android:versionName="1.0">
 <uses-sdk android:minSdkVersion="8" />
 <application icon="@drawable/icon" label="@string/app_name">
   <service class=".MyService" android:name=".MyService">
     <intent-filter>
       <action android:value="com.javaorigin.android.sample.service.MY_SERVICE"
               android:name=".MyService" />

       </intent-filter>
   </service>
  <activity android:name=".SampleAction"

             android:label="@string/app_name">
             <activity android:name=".getLocation"/>
       <intent-filter>
           <action android:name="android.intent.action.MAIN"/>
           <category android:name="android.intent.category.LAUNCHER"/>
       </intent-filter>
   </activity>

 </application>
   <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
   <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
  <uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION" />
  </manifest>

Logcat Message

  01-12 14:12:08.911: ERROR/AndroidRuntime(4071): java.lang.RuntimeException: Unable to start service com.javaorigin.android.sample.service.MyService@44ee3168 with Intent { cmp=com.javaorigin.android.sample.service/.MyService }: android.content.ActivityNotFoundException: Unable to find explicit activity class {com.javaorigin.android.sample.service/com.javaorigin.android.sample.service.getLocation}; have you declared this activity in your AndroidManifest.xml?
  01-12 14:12:08.911: ERROR/AndroidRuntime(4071):     at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:3063)
  01-12 14:12:08.911: ERROR/AndroidRuntime(4071):     at android.app.ActivityThread.access$3600(ActivityThread.java:125)
  01-12 14:12:08.911: ERROR/AndroidRuntime(4071):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2096)
  01-12 14:12:08.911: ERROR/AndroidRuntime(4071):     at android.os.Handler.dispatchMessage(Handler.java:99)
  01-12 14:12:08.911: ERROR/AndroidRuntime(4071):     at android.os.Looper.loop(Looper.java:123)
  01-12 14:12:08.911: ERROR/AndroidRuntime(4071):     at android.app.ActivityThread.main(ActivityThread.java:4627)
  01-12 14:12:08.911: ERROR/AndroidRuntime(4071):     at java.lang.reflect.Method.invokeNative(Native Method)
  01-12 14:12:08.911: ERROR/AndroidRuntime(4071):     at java.lang.reflect.Method.invoke(Method.java:521)
  01-12 14:12:08.911: ERROR/AndroidRuntime(4071):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
  01-12 14:12:08.911: ERROR/AndroidRuntime(4071):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
  01-12 14:12:08.911: ERROR/AndroidRuntime(4071):     at dalvik.system.NativeStart.main(Native Method)
  01-12 14:12:08.911: ERROR/AndroidRuntime(4071): Caused by: android.content.ActivityNotFoundException: Unable to find explicit activity class {com.javaorigin.android.sample.service/com.javaorigin.android.sample.service.getLocation}; have you declared this activity in your AndroidManifest.xml?
 01-12 14:12:08.911: ERROR/AndroidRuntime(4071):     at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1404)
01-12 14:12:08.911: ERROR/AndroidRuntime(4071):     at android.app.Instrumentation.execStartActivity(Instrumentation.java:1378)
01-12 14:12:08.911: ERROR/AndroidRuntime(4071):     at android.app.ContextImpl.startActivity(ContextImpl.java:622)
01-12 14:12:08.911: ERROR/AndroidRuntime(4071):     at android.content.ContextWrapper.startActivity(ContextWrapper.java:258)
 01-12 14:12:08.911: ERROR/AndroidRuntime(4071):     at com.javaorigin.android.sample.service.MyService.onStart(MyService.java:25)
 01-12 14:12:08.911: ERROR/AndroidRuntime(4071):     at android.app.Service.onStartCommand(Service.java:420)
01-12 14:12:08.911: ERROR/AndroidRuntime(4071):     at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:3053)
01-12 14:12:08.911: ERROR/AndroidRuntime(4071):     ... 10 more

my code

public class MyService extends Service {

 String tag="TestService";
private Intent Information;
 @Override
 public void onCreate() {
   super.onCreate();
   Toast.makeText(this, "Service created...", Toast.LENGTH_LONG).show();      
   Log.i(tag, "Service created...");
 }

 @Override
  public void onStart(Intent intent, int startId) {      
   super.onStart(intent, startId);  
    Intent i=new Intent(getBaseContext(),getLocation.class);
   i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
   this.startActivity(i);       Log.i(tag, "Service started...");
 }
 @Override
  public void onDestroy() {
   super.onDestroy();
   Toast.makeText(this, "Service destroyed...", Toast.LENGTH_LONG).show();
 }

  @Override
  public IBinder onBind(Intent intent) {
   return null;
 }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T08:14:10+00:00Added an answer on May 28, 2026 at 8:14 am

    Apply this code,this will start your Receiver

          Intent myIntent = new Intent ( context, getLocation.class );
            myIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            context.startActivity(myIntent);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hai am trying to get the gps location using BroadCast Receiver.its working fine,But i
Hai i treid to access the latitude and longtitude value in background service in
Hai Guys, How to get wan ip address of my user using php....
hai i am very new to jquery and jqgrid.. i have implemented a grid...but
Hai I am using the following code to access columns in a row but
I have the following HTML <label class=editable id=user_info_username>Hai world...</label> now on click function i
Hai i created a DataBase and inserted the value in one Class,and i try
Hai i tried to add the timer function in broadcast receiver application to receive
Hai i want to generated an automated click event. I am working in php
I tried to write a function on a JS file and another function with

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.