Reputation: 523
The AppStore now require an IPhone 11 (or high IPhone X) skin for their 6.5inch metadata images. Please can someone point me in the direction to it, for use in my Codenameone simulator.
I am on the latest install (CN1 v6), which has up to IPhoneX.skin in my .codenameone folder, but i would like to future proof as much as i can, so go with the 11. Thanks
Upvotes: 1
Views: 170
Reputation: 6249
I had the same problem. I use a different approach to get one or more screenshots as required by the stores. In short, I execute the app on "Browser Stack App Live" (that has several real devices, like the required iPhone 11), using a code that programmatically send me one or more screenshots of the app, using a REST request.
Note that on Browser Stack App Live it's not possible to send e-mails, that's why I created my own REST API for screenshot uploads.
It's easy, I tested the following solution before sharing it. On a temporary VPS with Apache + PHP installed, or on your local machine if you have a public IP, create the following upload.php
, remembering to update $server_url
with your actual url:
<?php
header('Content-Type: application/json; charset=utf-8');
header("Access-Control-Allow-Origin: *");
header("Access-Control-Allow-Methods: PUT, GET, POST");
$response = array();
$upload_dir = 'uploads/';
$server_url = 'https://www.example.com/mydir/';
if($_FILES['screenshot'])
{
$screenshot_name = $_FILES["screenshot"]["name"];
$screenshot_tmp_name = $_FILES["screenshot"]["tmp_name"];
$error = $_FILES["screenshot"]["error"];
if($error > 0){
$response = array(
"status" => "error",
"error" => true,
"message" => "Error uploading the file!"
);
}else
{
$random_name = rand(1000,1000000)."-".$screenshot_name;
$upload_name = $upload_dir.strtolower($random_name);
$upload_name = preg_replace('/\s+/', '-', $upload_name);
if(move_uploaded_file($screenshot_tmp_name , $upload_name)) {
$response = array(
"status" => "success",
"error" => false,
"message" => "File uploaded successfully",
"url" => $server_url."/".$upload_name
);
}else
{
$response = array(
"status" => "error",
"error" => true,
"message" => "Error uploading the file!"
);
}
}
}else{
$response = array(
"status" => "error",
"error" => true,
"message" => "No file was sent!"
);
}
echo json_encode($response);
?>
After that, mkdir uploads
and chown
the permissions of the php file and of the upload dir accordingly.
The server is ready.
On your app, add the following method (remember to change the String url
value):
public static void sendMeScreenshot() {
Form form = Display.getInstance().getCurrent();
if (form != null) {
try {
Image screenshot = Image.createImage(form.getWidth(), form.getHeight());
form.paintComponent(screenshot.getGraphics(), true);
String file = FileSystemStorage.getInstance().getAppHomePath() + "/screenshot_" + System.currentTimeMillis() + ".png";
OutputStream output = FileSystemStorage.getInstance().openOutputStream(file);
ImageIO.getImageIO().save(screenshot, output, ImageIO.FORMAT_PNG, 1.0f);
String url = "https://www.example.com/mydir/upload.php";
MultipartRequest request = new MultipartRequest();
request.setUrl(url);
request.addData("screenshot", file, "multipart/form-data");
NetworkManager.getInstance().addToQueue(request);
} catch (IOException ex) {
Log.e(ex);
}
}
}
Finally, use a code like UITimer.timer(5000, false, hi, () -> sendMeScreenshot());
to get a screenshot of the Form you are interested to, after the wanted time.
Test in the Simulator, it should work. Add some logging and check the returned JSON in the Network Monitor. If it's all ok, open your app with Browser Stack App Live, selecting the wanted device (iPhone 11 in this case). You will find the screenshot (or screenshots) on the choosen upload
dir of your VPS. You can download them with scp
or open directly them in your browser.
This solution is useful if you don't own the required device, but keep in mind to don't keep online your upload.php
to don't have security issues.
Upvotes: 2
Reputation: 52760
We don't have an iPhone 11 skin yet although you can file an RFE on that here. But this doesn't matter for most.
Most people use tools such as these to generate the screenshots in a portable way:
Upvotes: 2