I want to send a notification FROM my iPhone to another iPhone [closed] - iphone

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
before I start I realize this issue has been raised before in this forum because I found the thread. However, the question was not answered.
I am building a system using iPhones as the worker machines. I phrase it like this because I want to place an emphasis on the phone not being some product of apple but as a piece of equipment which is either capable or not of performing a given task.
I have jailbroken both phones I am using and will use them exclusively to achieve a solution to the problem the system sets out to solve. My system will be used by me and me alone and so the issue of how Apple intended these devices to be used, the user experience etc is irrelevant to me.
Ok, having said all that I'll briefly outline the system. Two iPhones, one with its guts in an electronics project box nailed above my front door, camera facing visitors. Other iPhone, intact and in my pocket. I have hooked pins 1 & 11 to the door bell button and alert the phone to its being pressed by monitoring the audio route change. I need an app on my pocket phone that will be woken by a notification sent by the door phone. The door phone will also send an image once I have accepted the notification on my pocket phone. There is no internet here at all, I do however have a wifi router to which both phones are connected.
So that's the system, I have searched high and low to find code that can help me to get the door phone to generate a push notification and send it to my pocket phone, all I have found so far is this https://github.com/stefanhafeneger/PushMeBaby which is what I need only it's written for mac not iPhone and I'm new to Objective C so porting is really hard.
Please could someone give me a hand to accomplish what I am trying to do, I know Apple didn't intend for me to use its product like I am but then neither do a lot of manufacturers but hobbyists still manage to use them in ever more inventive and innovative ways irrespective. I am currently using a PC and a webcam to see who's at the door and it uses a lot of electric, the new system is far better if only I can get it to work so please, please if you have the ability/knowledge to help me then post a reply and I will be eternally grateful. Thanks you, Richard.

Pair the phones with Bluetooth using GameKit.
Here's an SO question about how to bluetooth pair two iPhones: How to use bluetooth to connect two iPhone?
The easiest way is using the highly opaque GameKit. Here's an Apple example app that achieves this: http://developer.apple.com/library/ios/#samplecode/GKTank/Introduction/Intro.html
And from that example that snippet that sends packets (in TankViewController.m):
- (void)sendNetworkPacket:(GKSession *)session packetID:(int)packetID withData:(void *)data ofLength:(int)length reliable:(BOOL)howtosend {
// the packet we'll send is resued
static unsigned char networkPacket[kMaxTankPacketSize];
const unsigned int packetHeaderSize = 2 * sizeof(int); // we have two "ints" for our header
if(length < (kMaxTankPacketSize - packetHeaderSize)) { // our networkPacket buffer size minus the size of the header info
int *pIntData = (int *)&networkPacket[0];
// header info
pIntData[0] = gamePacketNumber++;
pIntData[1] = packetID;
// copy data in after the header
memcpy( &networkPacket[packetHeaderSize], data, length );
NSData *packet = [NSData dataWithBytes: networkPacket length: (length+8)];
if(howtosend == YES) {
[session sendData:packet toPeers:[NSArray arrayWithObject:gamePeerId] withDataMode:GKSendDataReliable error:nil];
} else {
[session sendData:packet toPeers:[NSArray arrayWithObject:gamePeerId] withDataMode:GKSendDataUnreliable error:nil];
}
}
}

I can't think of an easy way to send a message directly from one phone to the other. (although I'm not used to jailbroken stuff, so who knows...). In any case, here's what I would do:
Set up a simple web server to interface between the two devices. You say you don't have internet, so just running Apache or whatever on a local computer on the network should do the trick. Whenever you want to send a message, the sending phone posts something to the server. Unfortunately, if you can't/don't want to use Apple's push notification service, I think the receiving phone is going to have to constantly monitor the server to see if there are any new messages. :(

Related

How to send and receive custom data with Phone through Bluetooth between close devices using Flutter dart?

The interaction should be automatic:
if a device enters in another device's area (or, if it is not possibile, they are in the same "region"), they send and receive a custom object (made of strings and ints).
So, there is no manual scanning or sending.
I looked at many libraries, but it seems impossibile to send custom data via Bluetooth and be in costant listening.
Please help. Thanks in advance!
Edit 1: So, I realized it exists a way of broadcast sending and monitoring with two separate libraries. Now, I have to understand how to make my custom UUID. Maybe I could scan only for those who have the same layout or something (AltBeacons are new to me).

Record the conversation of phone - ios [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Is an iPhone Call Recorder theoretically possible?
I am an iPhone devleoper.
I want to record the conversation during phone call.
I don't know apple is allowing to do this or not.
If yes, than can anybody guide me how can i do this?
Basically In my app ,I am recording 1 audio .
Now when i call someone from my contact ,I want to play that audio as well as record the conversation.
Both play and record thing I want.
I am confused whether it is possible or not.
There is no public API for recording the calls made (or received) by the built-in Phone app.
You will have to implement your own phone calling mechanism. You'll probably want to use VoIP. (That is what Google Voice uses, for example.) You'll need to run your own server on the Internet, or contract with an existing VoIP service. You'll want to use in-app purchase to let the user buy minutes, because it costs money to run your own server or use a third-party service.
There is no public API for this. No app headed for the App Store can record phone calls made with the standard Phone app.

Using Remote Notifications In My Application

I am currently starting my way on developing iPhone applications, and I have recently encountered a problem which I could not find a proper answer to.
In my application, I want one iPhone to send a request and another, far iPhone respond to that request using an Alert View, almost like the way Game Center works when you invite someone to play with you.
Do I do that with Push Notifications? Some server? Or what?
Thanks ahead,
A Newbie Developer.
Not the simplest things to try and do when you are new - but have a look at GameKit.
There is a sample application called GKTap which shows how to hook up two iPhones.
Don't be fooled by the word Game. This framework makes it easy to set up communication between phones, even using Bluetooth.
It depends on what you mean by "far". If you mean in another room, but within Bluetooth range or on the same local network, then there is GameKit. If you mean on a different network, or a long distance away, then you are looking at needing to have a server that keeps track of the devices and the connections between the devices so you can use Push Notifications. If you are thinking of something like Words With Friends where it sends a message to another user to tell them it is their go, then you would need the server.

Am I using CNCopyCurrentNetworkInfo correctly?

I'm having some issues with the data returned by CNCopyCurrentNetworkInfo and was wondering if I'm doing something wrong.
I'm using the following code to display the BSSID of the currently connected Access Point:
NSArray* interfaces = (NSArray*) CNCopySupportedInterfaces();
for (NSString* interface in interfaces) {
CFDictionaryRef networkDetails = CNCopyCurrentNetworkInfo((CFStringRef) interface);
if (networkDetails) {
NSLog(#"all details: %#", (NSDictionary *)networkDetails);
NSLog(#"BSSID: %#", (NSString *)CFDictionaryGetValue (networkDetails, kCNNetworkInfoKeyBSSID));
CFRelease(networkDetails);
}
}
By reviewing the NSLog statements it appears as though CNCopyCurrentNetworkInfo is hanging onto old data for kCNNetworkInfoKeyBSSID under certain circumstances.
I have two access points set up and I'm trying to obtain the BSSID of the currently connected AP. If I start with only one AP turned on it returns the correct BSSID. If I switch that AP off I get no BSSID (correct) and when I switch on the second AP and connect to it I am given the correct BSSID of the second AP.
However if I start with one AP turned on run this code and am correctly given the BSSID of that AP. I then turn on the second AP, then turn off the first (forcing the device to roam to the second AP) the log statements still return the BSSID of the first AP (which I have turned off and am not possibly connected to).
Does anyone have more experience with this than I've had? Am I meant to be manually flushing the values returned by CNCopyCurrentNetworkInfo between calls?
I am have run this on both a 4th gen iPod touch running iOS 4.3 built using Xcode 4 and an iPhone 4 running iOS 4.1 built using Xcode 3.2.4
I'm going to provide an answer to this question because it seems to get the occasional up vote and could do with a solution.
Short version is that yes that is how you're supposed to use CNCopyCurrentNetworkInfo. This is a bug in iOS 4 and 5. If you're currently running an iOS 6 beta I would suggest investigating whether it still operates this way on there and reporting it to Apple if it does.
I was fortunate in that I work on enterprise applications and was able to gain this information using calls to private APIs. For info on how to do this I would probably recommend looking here: iphone-wireless on google code

Get the device's phone number programmatically [duplicate]

This question already has answers here:
Programmatically get own phone number in iOS
(9 answers)
Closed 9 years ago.
I need to get my iOS device's phone number programatically.
Via google I found this code:
NSString *num = [[NSUserDefaults standardUserDefaults] stringForKey:#"SBFormattedPhoneNumber"];
NSLog(#"Phone Number: %#", num);
But somewhere I read that if I use this code, Apple will reject my app.
Is there any way to get current device phone number without user entry?
No, the device's phone number is not available programmatically and still be approved by Apple, thankfully. I definitely don't want some free app I download out of curiosity to grab my phone number and start sending me spam SMS messages or have marketers calling me.
Your already have the answers:
Can any one pls help me is there any
way to get current device number
without user entry.
Yes, using the piece of code you have in your question.
And, YES, if you get phone number programmatically WITHOUT user input, your App will be rejected by Apple.
This is plain and simple.
If you need the number, ask for it from the user. If they trust you, they will input the number.