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

  • SEARCH
  • Home
  • 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 8691395
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T00:06:55+00:00 2026-06-13T00:06:55+00:00

Trying to convert my iOS app to android, I know I can’t port it

  • 0

Trying to convert my iOS app to android, I know I can’t port it so I wrote it from scratch
How can I covert this notification to Android Java code?

-(IBAction)turnon {

    NSDateComponents *comps = [[NSDateComponents alloc] init];
    [comps setDay:28];
    [comps setMonth:9];
    [comps setYear:2012];
    [comps setHour:8];
    [comps setMinute:25];
    NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
    NSDate *fireDate = [gregorian dateFromComponents:comps];

    UILocalNotification *alarm = [[UILocalNotification alloc] init];

    alarm.fireDate = fireDate;
    alarm.repeatInterval = NSDayCalendarUnit;
    alarm.soundName = @"msl.aiff";
    alarm.alertBody = @"This is a message..";
    alarm.timeZone = [NSTimeZone defaultTimeZone];

    [[UIApplication sharedApplication] scheduleLocalNotification:alarm];

I’ve searched the web for like 4 hours now and I think this is simple for an Android developer but since I just started I just don’t have any idea how to do this.

Any help is really appreciated!

  • 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-06-13T00:06:56+00:00Added an answer on June 13, 2026 at 12:06 am

    This is what your looking for:
    You can use the alarm manager to show notifications at specific times, even when your app is not running at all.

    http://developer.android.com/reference/android/app/AlarmManager.html

    Everyday notifications at certain time

    This one is useful to:

    Using Alarmmanager to start a service at specific time

    Edit see comments:

    You can the AlarmManager for this, first create you self some kind of reciever.

    import android.content.BroadcastReceiver;
    import android.content.Context;
    import android.content.Intent;
    import android.util.Log;
    
    public class AlarmReceiver extends BroadcastReceiver {
    
        @Override
        public void onReceive(Context context, Intent intent) {
            Intent dailyUpdater = new Intent(context, MyService.class);
            context.startService(dailyUpdater);
            Log.d("AlarmReceiver", "started service");
        }
    }
    

    Than you need to create the service which is going to show the notifications

    import android.app.NotificationManager;
    import android.app.PendingIntent;
    import android.app.Service;
    import android.content.Intent;
    import android.os.Binder;
    import android.os.IBinder;
    import android.support.v4.app.NotificationCompat;
    import android.util.Log;
    import android.widget.Toast;
    
    public class MyService extends Service {
        private NotificationManager mNM;
    
    
        private int NOTIFICATION = 546;
    
        public class LocalBinder extends Binder {
            MyService getService() {
                return MyService.this;
            }
        }
    
        @Override
        public void onCreate() {
            mNM = (NotificationManager)getSystemService(NOTIFICATION_SERVICE);
    
            showNotification();
        }
    
        @Override
        public int onStartCommand(Intent intent, int flags, int startId) {
            showNotification();
            return START_STICKY;
        }
    
        @Override
        public void onDestroy() {
            mNM.cancel(NOTIFICATION);
            Toast.makeText(this, "stopped service", Toast.LENGTH_SHORT).show();
        }
    
        @Override
        public IBinder onBind(Intent intent) {
            return mBinder;
        }
    
        private final IBinder mBinder = new LocalBinder();
    
        private void showNotification() {
            Toast.makeText(this, "show notification", Toast.LENGTH_SHORT).show();
    
            //notification code here
    
    
        }
    }
    

    And finally you need to set the alarm:

    private void setRecurringAlarm(Context context) {
        Calendar updateTime = Calendar.getInstance();
        updateTime.set(Calendar.HOUR_OF_DAY, 20);
        updateTime.set(Calendar.MINUTE, 30);
    
        Intent open = new Intent(context, AlarmReceiver.class);
        open.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        PendingIntent pendingIntent = PendingIntent.getBroadcast(context, 0, open, PendingIntent.FLAG_CANCEL_CURRENT);
        AlarmManager alarmManager = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
        alarmManager.setRepeating(AlarmManager.RTC_WAKEUP, SystemClock.elapsedRealtime() + 5000, 10000, pendingIntent); 
    }
    

    And before you make a test run add your Receiver and Service to your manifest file:

    <service android:name=".MyService"></service>
    <receiver android:name=".AlarmReceiver"></receiver>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have an iOS app whose push notification cert has expired and we're trying
Trying to convert output from a rest_client GET to the characters that are represented
Trying to convert the following but am having difficulty. Can anyone see where I'm
Trying to convert this c code into MIPS and run it in SPIM. int
im trying to convert a date format into a new format in this example
I'm trying to convert dicom .dcm file to .jpeg using Imebra in C++ app
I'm trying convert xml from one format to other using the XslCompiledTransform in c#.
Trying to convert some code, but for all my googling I can't figure out
Im trying to add to a mutable array and can not figure this out.
I'm trying to cross-compile several libraries from OSX to iOS. I've successfully cross-compiled libjpeg

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.